# Makefile for MudGUI

include ../../common.mk

INCDIRS := ../../$(INCDIR)
LIBDIRS := ../../$(LIBDIR)
SRCS := $(wildcard *.bas)

OBJS := $(SRCS:%.bas=%.o)

LIBNAME := mudgui-stdwidgets

LIBRARY := $(LIBDIRS)/lib$(LIBNAME).a

FBC_CFLAGS += -w all -i $(INCDIR)
FBC_LFLAGS += -p $(LIBDIR)

ifndef NDEBUG
	FBC_CFLAGS += -g
endif

ifdef PROFILE
	FBC_CFLAGS += -profile
endif

ifdef EXX
	FBC_CFLAGS += -exx
endif

ifdef OPT
	FBC_CFLAGS += $(OPT)
endif

# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#  targets
# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

all : $(LIBRARY)

.PHONY : install
install : $(LIBRARY)
	@$(CP) $(LIBDIRS)/lib$(LIBNAME).a $(INSTALLDIR)/$(LIBPREFIX)/lib$(LIBNAME).a


# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#  rules
# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

$(LIBRARY) : $(OBJS)
	test -e $(LIBDIRS) || $(MD) -p $(LIBDIRS)
	$(FBC) -lib -x $(LIBDIRS)/$(LIBNAME) $(FBC_CFLAGS) $(OBJS)

%.o : %.bas
	$(FBC) -c $(FBC_CFLAGS) -i $(INCDIRS) $(CORE_INC_FLAGS) $< -o $@

# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#  clean
# :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

.PHONY : clean
clean :
	@echo Removing object files..
	$(RM) -f $(OBJS)



